package edu.uj.petri.document;

import edu.uj.petri.commands.CommandStack;
import edu.uj.petri.commands.Command;
import edu.uj.petri.commands.CommandException;

/**
 * abstract basic class for document modes, having and handling command stack
 * @author Piotrek
 */
abstract class ConcreteMode implements Mode {
    
    protected CommandStack commandStack;

    public ConcreteMode() {
        commandStack = new CommandStack();
    }

    public void undo() throws CommandException {
        commandStack.undo();
    }

    public void redo() throws CommandException {
        commandStack.redo();
    }

    public void execute(Command command) {
        commandStack.execute(command);
    }
}
